function PHatCalc= calculatePHat_fixedW_2Zs(w,t,X,wantedZ,R,C)
PHatCalc=zeros(t,R,C);
for i = 1: t
    
       
    
    for  ii = 1:4
        for jj=1:C
            if jj==1
                down=normcdf((X(ii,jj+1)-w(1).*wantedZ(i,1))./sqrt(1-w(1).^2),0,1);
                PHatCalc(i,ii,jj)=1-down;
            elseif jj==C
                up=normcdf((X(ii,jj)-w(1).*wantedZ(i,1))./sqrt(1-w(1).^2),0,1);                 
                PHatCalc(i,ii,jj)=up;
            else
                up=normcdf((X(ii,jj)-w(1).*wantedZ(i,1))./sqrt(1-w(1).^2),0,1);
                down=normcdf((X(ii,jj+1)-w(1).*wantedZ(i,1))./sqrt(1-w(1).^2),0,1);
                PHatCalc(i,ii,jj)=up-down;
            end
        end
    end
    
    
    for ii = 5:R
        for jj=1:C
            if jj==1
                down=normcdf((X(ii,jj+1)-w(2).*wantedZ(i,2))./sqrt(1-w(2).^2),0,1);
                PHatCalc(i,ii,jj)=1-down;
            elseif jj==C
                up=normcdf((X(ii,jj)-w(2).*wantedZ(i,2))./sqrt(1-w(2).^2),0,1);
                PHatCalc(i,ii,jj)=up;
            else
                up=normcdf((X(ii,jj)-w(2).*wantedZ(i,2))./sqrt(1-w(2).^2),0,1);
                down=normcdf((X(ii,jj+1)-w(2).*wantedZ(i,2))./sqrt(1-w(2).^2),0,1);
                PHatCalc(i,ii,jj)=up-down;
            end
        end
    end
    
    
    
    
    
    
end

end

